export const columns = [
  {
    prop: 'id',
    label: 'ID',
    width: 80
  },
  {
    prop: 'username',
    label: '用户名',
    width: 200
  },
  {
    prop: 'nickname',
    label: '昵称'
  },
  {
    prop: 'roles',
    label: '角色',
    render:(item:any) => {
      return item.roles.map((item:any) => item.name).join(',')
    }
  },
  {
    prop: 'avatar',
    label: '头像'
  },
  {
    label: '操作',
    slot: 'action',
    fixed: 'right',
    width: 200
  }
]

export const formConfig = [
  {
    type: 'input',
    prop: 'username',
    label: '用户名',
    span: 12,
    rules: [{ required: true, message: '请输入用户名', trigger: 'blur' }]
  },
  {
    prop: 'nickname',
    label: '昵称',
    span: 12,
    rules: [{ required: true, message: '请输入昵称', trigger: 'blur' }]
  },
  {
    prop: 'roleIds',
    label: '角色',
    span: 24,
    type: 'select',
    attrs:{multiple: true},
    rules: [{ required: true, message: '请选择角色', trigger: 'change' }]
  },
  {
    prop: 'avatar',
    label: '头像',
    span:24,
    type: 'upload',
    attrs:{
      accept: 'image/*',
      maxSize: 1024 * 1024 * 2,
      limit:1,
      tips:'请上传小于2M的图片',
      multiple:false
    },
  },
  {
    prop: 'qq',
    label: 'QQ',
    span: 12,
  },
  {
    prop: 'email',
    label: '邮箱',
    span: 12,
  },
]
